#pragma once
#pragma once
#include "../src_basics/utils.h"
#include "../src_basics/dataStructAlg.h"

class SlideLine {
public:
	SlideLine() :m_mode(0) {}
	SlideLine(int mode) :m_mode(mode) {}
	~SlideLine() {}

	//1.推线
	int pushSingleLine(std::vector<Line>& polyLines, Line& slideLine, const Point offset, const bool postOn);
	//2.推Pin
	int pushOnePt(std::vector<Line>& polyLines, Point& pt, const Point offset);


	//参数接口
	void setMode(int mode) { m_mode = mode; }
	void setInGreed(bool inGreed) { m_inGreed = inGreed; }
private:
	//算法参数
	int m_mode = 0;		//0推wire点，1推Pin
	bool m_inGreed = false;



private:
	//算法运行参数
	double MIN_NUM = 1;				// 推挤线的最短长度
	bool critical_value = false;	// 判断当前推挤线段是否到达临界情况

	//辅助函数
	//1. 推线
	void determineConnection(std::vector<Line>& lineVec, int index, Line& slideline);
	void inspectSingleLines(Line& slideLine, std::vector<Line>& lineVec);
	void pushSingleSeg(Line& line, const Point& offset);
	Point getSlideProjection(const Point& offsetVec, const Point& baseVec);
	Point getPINCrossingPoint(Point referencePoint, Line slideline, bool front);
	bool judgement(Line preLine, const Line& line) const;
	void slidePostProcessing(std::vector<Line>& polyLines);

	//2.推Pin
	int getPtLines(const std::vector<Line>& lines, const Point& pt, bool& isPt1);  //获取点在折线中的线段索引,pt在lines[res].Pt2,起点返回-1

};